<template>
  <div>
    <m-head title="主题内容"></m-head>
    <div class="list">
      <div class="item" v-for="(item, id) in list" v-bind:key="id" @click="$router.push({path:'/articledetail',query:{id:item.id}})">
        <h3>{{item.title}}</h3>
        <p>{{item.content}}</p>
        <span>{{item.reader}}阅读</span>
      </div>
    </div>
  </div>
</template>

<script>
import MHead from './MHeader'
import * as info from '../api/info'
export default {
  name: 'my-collection',
  components: {
    'm-head': MHead
  },
  data () {
    return {
      list: {}
    }
  },
  mounted () {
    this.getList()
  },
  methods: {
    getList () {
      info.getArticlesList().then(res => {
        this.list = res.data
      })
    }
  }
}
</script>

<style scoped>
  .list{
    border-top: 10px solid #f5f5f5;
  }
  .item{
    padding: .3rem;
    border-bottom: 10px solid #f5f5f5;
  }
  .item h3{
    font-size: .42rem;
    font-weight: bold;
    color: #000;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .item p{
    font-size: .38rem;
    color: #555;
    margin: .2rem 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  .item span{
    font-size: .34rem;
    color: #888;
  }
</style>
